when to use for and while loop